package h0705;

import java.util.*;

/**
 * @author 不知名帅哥
 * @version 1.0
 * @description Api集群负载统计
 * @date 2024/7/5 21:27
 */
public class APIClusterLoadStatistics {
    static Map<Integer, Map<String, Integer>> map = new HashMap<>();

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //  层级        字符串   出现的次数
        List<String> strings = new ArrayList<>();
        while (scanner.hasNext()) {
            String s = scanner.nextLine();
            strings.add(s.substring(1));
        }
        int i = 2;
        String str = "computing";
        System.out.println(getResult(strings, i, str));
    }

    public static int getResult(List<String> list, int a, String s) {
        for (int i = 0; i < list.size(); i++) {
            String[] split = list.get(i).split("/");
            //统计当前层级每个字符串出现的字数
            for (int j = 0; j < split.length; j++) {
                Map<String, Integer> value = map.get(j + 1);
                if (value != null) {
                    value.put(split[j], value.getOrDefault(split[j], 0) + 1);
                }else {
                    //第一次未申请
                    value = new HashMap<>();
                    value.put(split[j], value.getOrDefault(split[j], 0) + 1);
                }
                map.put(j + 1, value);
            }
        }
        Map<String, Integer> res = map.get(a);
        return res.get(s);
    }
}
